import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CakeMaterialCpVO, CakeMaterialCpForm, CakeMaterialCpQuery } from '@/api/sj/cakeMaterialCp/types';

/**
 * 查询蛋糕材料组合列表
 * @param query
 * @returns {*}
 */

export const listCakeMaterialCp = (query?: CakeMaterialCpQuery): AxiosPromise<CakeMaterialCpVO[]> => {
  return request({
    url: '/sj/cakeMaterialCp/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询蛋糕材料组合详细
 * @param id
 */
export const getCakeMaterialCp = (id: string | number): AxiosPromise<CakeMaterialCpVO> => {
  return request({
    url: '/sj/cakeMaterialCp/' + id,
    method: 'get'
  });
};

/**
 * 新增蛋糕材料组合
 * @param data
 */
export const addCakeMaterialCp = (data: CakeMaterialCpForm) => {
  return request({
    url: '/sj/cakeMaterialCp',
    method: 'post',
    data: data
  });
};

/**
 * 修改蛋糕材料组合
 * @param data
 */
export const updateCakeMaterialCp = (data: CakeMaterialCpForm) => {
  return request({
    url: '/sj/cakeMaterialCp',
    method: 'put',
    data: data
  });
};

/**
 * 删除蛋糕材料组合
 * @param id
 */
export const delCakeMaterialCp = (id: string | number | Array<string | number>) => {
  return request({
    url: '/sj/cakeMaterialCp/' + id,
    method: 'delete'
  });
};
